let data = {}
let name = 'jack'

Object.defineProperty(data, 'name', {
    get: function () {
        console.log('get')
        return name    
    },
    set: function (newName) {
        console.log('set', name, newName)
        name = newName
    }
})

console.log(data.name)
data.name = 'Mary'
console.log(data.name)